package edu.towson.greenteam.command;
import edu.towson.greenteam.InformationAggregator;
import edu.towson.greenteam.menu.*;
import edu.towson.greenteam.order.*;
import edu.towson.greenteam.table.Table;

public class CMDPlaceOrder implements Command {
	InformationAggregator ia;
	Order newOrder;

	public CMDPlaceOrder(InformationAggregator ia, MenuItem orderedItem, Table tablePlacedFrom) {
		this.ia = ia;
		this.newOrder = new Order(0, orderedItem.getName(), orderedItem.getCurrentPrice(), tablePlacedFrom);
	}

	@Override
	public Object execute() {
		return ia.getOrders().add(newOrder);
	}
}
